var yzhomepageflag  = "dep";
$(function(){
	//页面加上查询条件
	showCondition(true);
	var totalQuota=[{code:'drg',name:'DRG指标',data:[{name:"产能指标", data:[{"quotaCode":"CMI", "quotaName":"CMI值"}, 
	                                                                    {"quotaCode":"DRGCount", "quotaName":"DRGs组数"}, 
	                                                                    {"quotaCode":"TotalWeight", "quotaName":"总权重"},
	                                                                    {"quotaCode":"InCaseCnt", "quotaName":"入组病例数"},
	                                                                    {"quotaCode":"WeightPerBed", "quotaName":"单位床产出"}]},
	                                                 {name:"效率指标", data:[{"quotaCode":"TimeEff","quotaName":"时间消耗指数"},
	                                                                     {"quotaCode":"FeeEff", "quotaName":"费用消耗指数"},
	                                                                     {"quotaCode":"PatientBaseRate", "quotaName":"患者基本费率(%)"}]},
	                                                 {name:"安全指标", data:[{"quotaCode":"Risk1Ratio", "quotaName":"低风险死亡率(%)"},
	                                                                      {"quotaCode":"Risk2Ratio", "quotaName":"中低风险死亡率(%)"}
//	                                                                      {"quotaCode":"CureRatio", "quotaName":"治愈好转率(%)"}
	                                                                      ]}
	                                                 ]},
	                     {code:'total',name:'常规指标',data:[{name:"产能指标", data:[{"quotaCode":"TotalCaseCnt", "quotaName":"出院病例数"},{"quotaCode":"TotalFee", "quotaName":"总费用(万元)"}]},
	                                                  {name:"效率指标", data:[{"quotaCode":"AvgDays", "quotaName":"平均住院日"},{"quotaCode":"AvgFee", "quotaName":"次均费用"}]},
	                                                  {name:"安全指标", data:[{"quotaCode":"DeadRatio", "quotaName":"死亡率(%)"},{"quotaCode":"DeadCaseCnt", "quotaName":"死亡病例数"}]}
	                                                  ]}
	              ];
	var defenQuota = [{
						code : 'depGroup',
						name : 'DRG指标',
						data : [{
								name : "科室组DRG评价",
								data : [{
											"quotaCode" : "TotalScore",
											"quotaName" : "综合得分"
										},{ 
										     "quotaCode":"CapacityScore",
										     "quotaName":"产能得分"											     
										  },{ 
										     "quotaCode":"EfficiencyScore",
										     "quotaName":"效率得分"											     
										  },{ 
										     "quotaCode":"QualityScore",
										     "quotaName":"安全得分"											     
										  }]
								}]
					}];
	var depQuota = [{
				code : 'drgs',
				name : 'DRG指标',
				data : [{
							name : "产能指标",
							data : [ {
								     "quotaCode":"CMI", 
							         "quotaName":"CMI值"
							        },{
					                	"quotaCode":"DRGCount",
					                	"quotaName":"DRGs组数"
					                },{
					                	"quotaCode":"TotalWeight", 
					                	"quotaName":"总权重"
					                },{
					                	"quotaCode":"InCaseCnt", 
					                	"quotaName":"入组病例"
					                }]
						}, {
							name : "效率指标",
							data : [{
										"quotaCode" : "TimeEff",
										"quotaName" : "时间消耗指数"
									}, {
										"quotaCode" : "FeeEff",
										"quotaName" : "费用消耗指数"
									}, {
										"quotaCode" : "WeightPerDoctor",
										"quotaName" : "每医师权重"
									}, {
										"quotaCode" : "WeightPerBedDays",
										"quotaName" : "每床日权重"
									}]
						}, {
							name : "安全指标",
							data : [{
										"quotaCode" : "Risk1Ratio",
										"quotaName" : "低风险死亡率",
										"quotaType":"ratio"
									}, {
										"quotaCode" : "Risk2Ratio",
										"quotaName" : "中低风险死亡率",
										"quotaType":"ratio"
									}]
						}]
			}];	
	var drgsQuota = [{
		code : 'drgs',
		name : 'DRG指标',
		data : [{
					name : "产能指标",
					data : [ {"quotaCode":"CMI", "quotaName":"CMI值"},{"quotaCode":"DRGCount","quotaName":"DRGs组数"},
					         {"quotaCode":"TotalWeight","quotaName":"总权重"},{"quotaCode":"InCaseCnt","quotaName":"入组病例"}]
				}, {
					name : "效率指标",
					data : [{"quotaCode" : "TimeEff","quotaName" : "时间消耗指数"}, {"quotaCode" : "FeeEff","quotaName" : "费用消耗指数"}]
				}, {
					name : "安全指标",
					data : [{"quotaCode" : "Risk1Ratio","quotaName" : "低风险死亡率","quotaType":"ratio"}, 
					        {"quotaCode" : "Risk2Ratio","quotaName" : "中低风险死亡率","quotaType":"ratio"}]
				}]
	}];	
	//加载开始界面正在加载数据样式
	
	//全院指标 (1.Hosp 2.All)
	loadHospQuota("Hosp", totalQuota, "yzhangAllQuotasId");
    //**************加载科室组drgs评价部分**********************
	//加载科室组drgs评价div页面布局
	loadDepGroupDrgspingjia(defenQuota,"科室组","yzhangdepgroupQuotasId","yzhangdepgroupdrgs-ul");
	//为下半部分加载数据 
	loadDepGroupDrgspingjiaData(defenQuota,"depGroup","loadDepgroupDrgsToDep","");	
	//**************加载drgs指标详情部分**********************
	//加载科室组drgs指标详情
	loadDepGroupDrgsQuota(drgsQuota,"科室组","yzhangDrgsQuotasIda","yzhangdrgs-ul");
    //为下半部分加载数据 
	loadDepGroupQuotaData(drgsQuota,"depGroup","loadDepgroupDrgsToDep","loadDepgroupDrgsToMdc");	
    //移除正在加载数据部分
   $(document).ajaxStop(function(){
		
	  });	
   
   $("#"+tabId+" #changeCardId").click(function(){
		
		//清空数据
		$('#'+tabId+' #yzhangdrgs-ul').empty();
		$('#'+tabId+' #yzhangDrgsQuotasIda').empty();
		if("dep"==yzhomepageflag)
		{
			//加载科室组drgs指标详情
			loadDepGroupDrgsQuota(drgsQuota,"MDC","yzhangDrgsQuotasIda","yzhangdrgs-ul");
		    //为下半部分加载数据 
			loadDepGroupQuotaData(drgsQuota,"mdc","loadMdcToAdrg","loadMdcToDep");
			yzhomepageflag = "dis";
		}
		//
		else if("dis"==yzhomepageflag)
		{
			//加载科室组drgs指标详情
			loadDepGroupDrgsQuota(depQuota,"科室组","yzhangDrgsQuotasIda","yzhangdrgs-ul");
		    //为下半部分加载数据 
			loadDepGroupQuotaData(depQuota,"depGroup","loadDepgroupDrgsToDep","loadDepgroupDrgsToMdc");
			yzhomepageflag = "dep";
		}
})
});



function loadDepgroupDrgsToDep(code,desc){
	  var param = jQuery.extend(true,{},paramTabPage[tabId]);
	  param.depGroupCode = code;
	 openTab('/pages/yzHome/yzhangHomeDep.jsp',desc+'|科室','depgroupdrgstodep'+code,'depgroupdrgstodep'+code,param);

}
function loadDepgroupDrgsToMdc(code,desc){
  	  var param = jQuery.extend(true,{},paramTabPage[tabId]);
	  param.depGroupCode = code;
	  openTab('/pages/yzHome/yzhangHomeMdc.jsp',desc+'|MDC','depgroupdrgstomdc'+code,'depgroupdrgstomdc'+code,param);
}
function loadMdcToAdrg(code,desc){
  	  var param = jQuery.extend(true,{},paramTabPage[tabId]);
	  param.mdcCode = code;
	openTab('/pages/yzHome/yzhangHomeAdrg.jsp',code+'|ADRG','mdctoadrgo'+code,'mdctoadrgo'+code,param);
}

function loadMdcToDep(code,desc,monitorType){
	  var param = jQuery.extend(true,{},paramTabPage[tabId]);
	  param.mdcCode = code;
	  param.monitorType=monitorType;
	  openTab('/pages/yzHome/yzhangHomeDisToDep.jsp',code+'|科室','yzmdctodep'+code,'yzmdctodep'+code,param);
}




